﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomerLevel.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta charset="utf-8" />
    <!--#include virtual="include/Head.ascx"-->
    <script type="text/javascript">
        var nPermissions = '<%=nPermissions %>';
        function openCustomerEdit(sId) {
            //var url = 'CustomerLevel.Edit.aspx';
            var url = 'CustomerLevel.Edit.aspx?tid=1';
            if (sId > 0)
                url += '&id=' + sId;
            window.open(url, 'CustomerLevelEdit', 'width=1000,height=600,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
        }
        function OpenCustomer(sender, url) {
            window.open(url, "customer", "height:400,top=0,toolbar=no,directories=no,location=no,menubar=no,status=no");
        }
    </script>
    <style type="text/css">
        .thheader
        {
            font-weight: bold;
            vertical-align: middle;
            text-align: center;
            font-size: 11px;
            border: 1px solid #ccc !important;
            line-height: 12px !important;
        }
        
        .tdboder
        {
            border: none !important;
        }
        
        .tdboder p
        {
            padding: 1px !important;
            width: 40px;
            border: 1px solid #ccc !important;
            border-bottom: 1px solid #ccc !important;
        }
        
        .colorblue
        {
            min-width: 60px;
            max-width: 60px;
            overflow: hidden;
            cursor: pointer;
            color: Blue;
            text-decoration: underline;
        }
        
        .colorhasactionplan
        {
            min-width: 60px;
            max-width: 60px;
            overflow: hidden;
            cursor: pointer;
            color: #FF7F50;
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div id="body-wrapper">
        <div id="header">
            <!--#include virtual="include/top.ascx"-->
        </div>
        <div id="main-content1">
            <h2>
                CUSTOMER LEVEL
            </h2>
            <div class="clear">
            </div>
            <div class="content-box" zoomable="false">
                <form id="frmCustomers" runat="server">
                <%if (nPermissions >= 9)
                      { %>
                <div style="margin-left: 10px; border: none; font-weight: bold;">
                    Select User:
                    <asp:DropDownList class="cls" ID="drAdminUser" runat="server" Width="100px" TabIndex="16"
                        AutoPostBack="True" OnSelectedIndexChanged="drAdminUser_Selected">
                    </asp:DropDownList>
                    &nbsp;
                    <asp:TextBox ID="txtKeywords" runat="server" placeHolder="Input customer name and press Enter"
                        OnTextChanged="txtKeywords_TextChanged" Width="230px"></asp:TextBox>
                    <asp:DropDownList class="cls" ID="ddLevel" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddLevel_Selected">
                        <asp:ListItem Text="LEVEL" Value="0"></asp:ListItem>
                        <asp:ListItem Text="VIP" Value="1"></asp:ListItem>
                        <asp:ListItem Text="REG" Value="2"></asp:ListItem>
                        <asp:ListItem Text="NOR" Value="3"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:DropDownList class="cls" ID="ddLiabilities" runat="server" AutoPostBack="True"
                        OnSelectedIndexChanged="ddLiabilities_Selected">
                    </asp:DropDownList>
                    <asp:DropDownList class="cls" ID="ddTb" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddTb_Selected">
                    </asp:DropDownList>
                </div>
                <%} %>
                <fieldset>
                    <div autofit="true" style="">
                        <asp:Repeater ID="rptData" runat="server">
                            <ItemTemplate>
                                <tr onmouseover="this.style.background='#dbf0c9'" onmouseout="this.style.background='#ffffff'"
                                    cusid='<%#Eval("ID") %>'>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "Index")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "LastUpdate")%>
                                    </td>
                                    <td editable="true" code="Goods">
                                        <%# DataBinder.Eval(Container.DataItem, "Goods") %>
                                    </td>
                                    <td editable="true" code="GoodsEx">
                                        <%# DataBinder.Eval(Container.DataItem, "GoodsEx") %>
                                    </td>
                                    <td editable="true" code="Name">
                                        <%# DataBinder.Eval(Container.DataItem, "Name") %>
                                    </td>
                                    <td title=' <%# DataBinder.Eval(Container.DataItem, "Address") %>'>
                                        <%# DataBinder.Eval(Container.DataItem, "Address")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "CusLevel_limit")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "Level")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "CusLevel_Liabilities")%>
                                    </td>
                                    <%-- <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "CusLevel_Debts_Incurred")%>
                                    </td>--%>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "CusLevel_TB")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "CusLevel_Contract_StartDate")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "CusLevel_Contract_EndDate")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "CusLevel_Note")%>
                                    </td>
                                    <td onclick='OpenCustomer(this,"<%# GetCustomerLink(DataBinder.Eval(Container.DataItem, "ID"),DataBinder.Eval(Container.DataItem, "PicID")) %>")'
                                        class='<%#GetCellClass(Eval("ID"))%>' title=' <%# DataBinder.Eval(Container.DataItem, "Pic") %>'>
                                        <%# DataBinder.Eval(Container.DataItem, "Pic")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "CusOfUser")%>
                                    </td>
                                    <%if (nPermissions >= 3)
                                          {%>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "Action") %>
                                    </td>
                                    <%} %>
                                </tr>
                            </ItemTemplate>
                            <HeaderTemplate>
                                <table cellspacing="0" cellpadding="0" width="100%" border="0" class="adminlist"
                                    editcellcontent="true">
                                    <thead>
                                        <tr>
                                            <th align="center" class="thheader" width="50px">
                                                Index
                                            </th>
                                            <th align="center" class="thheader" width="50px">
                                                Update
                                            </th>
                                            <th align="center" class="thheader resizeable" width="100px">
                                                Hàng XK
                                            </th>
                                            <th align="center" class="thheader resizeable" width="100px">
                                                Hàng NK
                                            </th>
                                            <th align="center" class="thheader resizeable" width="230px">
                                                Tên C.ty khách hàng
                                            </th>
                                            <th align="center" class="thheader resizeable" width="150px">
                                                Địa chỉ
                                            </th>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                Hạn mức
                                            </th>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                Phân loại khách hàng
                                            </th>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                Công nợ (ngày)
                                            </th>
                                            <%--<th align="center" class="thheader resizeable" width="75px">
                                                Phát sinh nợ đến nay
                                            </th>--%>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                TB (%)
                                            </th>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                Ngày ký HĐ
                                            </th>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                Ngày kết thúc HĐ
                                            </th>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                Ghi chú
                                            </th>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                Pic
                                            </th>
                                            <th align="center" class="thheader resizeable" width="75px">
                                                User
                                            </th>
                                            <%if (nPermissions >= 3)
                                                  {%>
                                            <th class="thheader" width="100px">
                                                Action
                                            </th>
                                            <%} %>
                                        </tr>
                                    </thead>
                            </HeaderTemplate>
                            <FooterTemplate>
                                </TABLE>
                            </FooterTemplate>
                        </asp:Repeater>
                    </div>
                </fieldset>
                <div class="clear">
                </div>
                <div id="footer">
                    <%=strPager%>
                </div>
                <input type="hidden" id="txtListCustomerIDAjaxLoad" value="<%=strListCustIDAjaxLoad %>">
                <input type="hidden" id="txtListCustomerID" name="txtListCustomerID" runat="server"
                    value=";" />
                </form>
            </div>
        </div>
    </div>
</body>
</html>
